package com.lufei4.chestnut.workspace.adapter;

import android.graphics.Rect;
import android.view.View;

import androidx.recyclerview.widget.RecyclerView;

/**
 * @ProjectName: Chestnut
 * @Package: com.lufei4.chestnut.workspace.adapter
 * @ClassName: SpacesItemDecoration
 * @Description: java类作用描述
 * @Author: liushijiang 15833013864@163.com
 * @CreateDate: 2021/1/14 10:32
 * @UpdateUser: 更新者：
 * @UpdateDate: 2021/1/14 10:32
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */

public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
    private int space;

    public SpacesItemDecoration(int space) {
        this.space = space;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view,
                               RecyclerView parent, RecyclerView.State state) {
//        outRect.left = space;
        outRect.right = space;
//        outRect.bottom = space;

        // Add top margin only for the first item to avoid double space between items
//        if (parent.getChildLayoutPosition(view) == 0)
//            outRect.top = space;
    }
}